package Chapter2.Comparing.c3;

public class Test1 {
    private int x;
    private String y;

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public String getY() {
        return y;
    }

    public void setY(String y) {
        this.y = y;
    }

    public static void main(String[] args) {
        Test1 a = new Test1();
        Test1 b = a;
        Test1 c = new Test1();

        a.setX(66);
        System.out.println(a.hashCode());
        System.out.println(b.hashCode());
        System.out.println(a.x);
        System.out.println(b.x);
        System.out.println(c.x);

        b.setX(777);
        System.out.println(b.hashCode());
        System.out.println(a.x);
        System.out.println(b.x);
        System.out.println(c.x);

        a.setY("ee");
        System.out.println(a.hashCode());
        c.setX(888);
        c.setY("eee");
        System.out.println(c.hashCode());
        System.out.println(a.x);
        System.out.println(b.x);
        System.out.println(c.x);

        b.setY("aa");
        System.out.println(a.equals(b));
        System.out.println(a.equals(c));

        System.out.println(a.toString());
        System.out.println(b.toString());
        System.out.println(c.toString());

    }

    @Override
    public String toString() {
        return "Test1{" +
                "x=" + x +
                ", y='" + y + '\'' +
                '}';
    }
}
